﻿using System;

namespace FNN.NetworkComponents
{
    [Serializable]
    public class Synapse
    {
        private Neuron _inputNeuron;
        private Neuron _outputNeuron;
        private double _weight;

        /// <summary>
        ///     Конструктор с параметрами
        /// </summary>
        /// <param name="weight">Вес</param>
        /// <param name="inputNeuron">Отправитель</param>
        /// <param name="outputNeuron">Получатель</param>
        public Synapse(double weight, Neuron inputNeuron, Neuron outputNeuron)
        {
            _weight = weight;
            _inputNeuron = inputNeuron;
            _outputNeuron = outputNeuron;
        }

        /// <summary>
        ///     Конструктор копирования
        /// </summary>
        /// <param name="source">Исходный экземпляр</param>
        public Synapse(Synapse source)
        {
            _weight = source._weight;
            _inputNeuron = new Neuron(source._inputNeuron);
            _outputNeuron = new Neuron(source._outputNeuron);
        }

        /// <summary>
        ///     Вес связи
        /// </summary>
        public double Weight
        {
            get { return _weight; }
            set { _weight = value; }
        }

        /// <summary>
        ///     Отправитель
        /// </summary>
        public Neuron InputNeuron
        {
            get { return _inputNeuron; }
            set { _inputNeuron = value; }
        }

        /// <summary>
        ///     Получатель
        /// </summary>
        public Neuron OutputNeuron
        {
            get { return _outputNeuron; }
            set { _outputNeuron = value; }
        }
    }
}